package com.lucky.common.service;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lucky.common.base.BaseService;
import com.lucky.common.mapper.DictMapper;
import com.lucky.common.pojo.po.DictPO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictService extends BaseService<DictMapper, DictPO> {

	public Logger log = LoggerFactory.getLogger(DictService.class);
	
	
	@Resource
	DictMapper dictMapper;
	
	public List<DictPO> querytDicList(DictPO po){
		return this.list(Wrappers.query(po));
		
	}
	
	public List<DictPO> queryList(String typeCode){
		return dictMapper.queryList(typeCode);
	}
	
	public DictPO get(String typeCode, String dicCode){
		return dictMapper.getOne(typeCode, dicCode);
	}
	public String getDictName(String typeCode, String dicCode){
		if(typeCode==null  || dicCode==null){
			return "";
		}
		DictPO po=this.get(typeCode, dicCode);
		if(po!=null){
			return  po.getDicname();
		}
		return "";
	}
}
